﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DisplayAllProfile.ascx.cs" Inherits="SonCa.SocialNetwork.Web.ASCX.DisplayAllProfile" %>
<script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
    function AddFriend(obj) {
        var friendID = $(obj).attr('class');                
        $.ajax({
            type: "post",
            url: "../Services/AjaxService.svc/SendInvitationRequest",
            data: '{"accountID": "' + friendID + '"}',
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            beforeSend: function () {
                $(".loading_addfriend_" + friendID).show();
            },
            success: function () {
                $("." + friendID).attr("src", "../img/requestsended.png");
                $("." + friendID).removeAttr("onclick");
                $("." + friendID).removeAttr("style");
                $(".loading_addfriend_" + friendID).hide();
            },
            error: function () { }
        });
    }
</script>


<tr>
    <td>
		<a id="linkOtherFriend" runat="server" href="">
            <asp:Image ID="imgFriend" runat="server" Width="32" Height="32" />
            <strong>
                <asp:Label ID="lblNameFriend" runat="server"></asp:Label>
            </strong>
        </a>
    </td>
    <td>
        <img src="../img/loading.gif" id="loading_addfriend" runat="server" alt="Loading..." style="display:none" />
        <img src="../img/icon_addFriend.png" id="imgAddFriend" runat="server" onclick='AddFriend(this)' alt="Add Friend" style="cursor:pointer" />
    </td>
</tr>